The type{0} does not support direct content - WPF / XAML

Posted by Levo on Stack Overflow See other posts from Stack Overflow or by Levo
Published on 2010-06-12T08:30:46Z Indexed on 2010/06/12 8:32 UTC
Read the original article Hit count: 214

Filed under:

Hi there:

I defined in my code two classes: a "Person" class with public "Age" and "Name" property, and a "People" class that inherits from Generic.List(of T).

The code for People class is as followed:

Public Class People
    Inherits Collections.Generic.List(Of Person)

    ...
End Class

What I want to achieve is to directly initialize the People class, and add individual Person to it in XAML, i.e.:

<local:People x:Key="Familty">
        <local:Person Age="11" Name="John" />          
        <local:Person Age="12" Name="John2" />
        ...
</local:People> 

But I keep getting an error in XAML saying: The type 'People' does not support direct content.

Any idea as for how to solve this problem?

Thank you very much!

© Stack Overflow or respective owner

Related posts about xaml